﻿using System;
using SharpSqlAnalyzer.nodes;

namespace SharpSqlAnalyzer.stmt.mssql
{
	// Token: 0x02000176 RID: 374
	public class TMssqlExecuteAs : TCustomSqlStatement
	{
		// Token: 0x06000CFD RID: 3325 RVA: 0x00308346 File Offset: 0x00306546
		public TMssqlExecuteAs(EDbVendor dbvendor) : base(dbvendor)
		{
			this.sqlstatementtype = ESqlStatementType.sstmssqlexecuteas;
		}

		// Token: 0x06000CFE RID: 3326 RVA: 0x0030835A File Offset: 0x0030655A
		internal override void buildsql()
		{
		}

		// Token: 0x06000CFF RID: 3327 RVA: 0x0030835C File Offset: 0x0030655C
		internal override void clear()
		{
		}

		// Token: 0x06000D00 RID: 3328 RVA: 0x0030835E File Offset: 0x0030655E
		internal override string getasprettytext()
		{
			return "";
		}

		// Token: 0x06000D01 RID: 3329 RVA: 0x00308365 File Offset: 0x00306565
		internal virtual void iterate(TVisitorAbs pvisitor)
		{
		}

		// Token: 0x17000263 RID: 611
		// (get) Token: 0x06000D03 RID: 3331 RVA: 0x00308370 File Offset: 0x00306570
		// (set) Token: 0x06000D02 RID: 3330 RVA: 0x00308367 File Offset: 0x00306567
		public virtual EExecuteAsOption ExecuteAsOption
		{
			get
			{
				return this.executeAsOption;
			}
			set
			{
				this.executeAsOption = value;
			}
		}

		// Token: 0x17000264 RID: 612
		// (get) Token: 0x06000D05 RID: 3333 RVA: 0x00308381 File Offset: 0x00306581
		// (set) Token: 0x06000D04 RID: 3332 RVA: 0x00308378 File Offset: 0x00306578
		public virtual TObjectName Cookie
		{
			get
			{
				return this.cookie;
			}
			set
			{
				this.cookie = value;
			}
		}

		// Token: 0x17000265 RID: 613
		// (get) Token: 0x06000D07 RID: 3335 RVA: 0x00308392 File Offset: 0x00306592
		// (set) Token: 0x06000D06 RID: 3334 RVA: 0x00308389 File Offset: 0x00306589
		public virtual bool NoRevert
		{
			get
			{
				return this.noRevert;
			}
			set
			{
				this.noRevert = value;
			}
		}

		// Token: 0x17000266 RID: 614
		// (get) Token: 0x06000D08 RID: 3336 RVA: 0x0030839A File Offset: 0x0030659A
		// (set) Token: 0x06000D09 RID: 3337 RVA: 0x003083A2 File Offset: 0x003065A2
		public TObjectName loginName
		{
			get
			{
				return this._loginName;
			}
			set
			{
				this._loginName = value;
			}
		}

		// Token: 0x06000D0A RID: 3338 RVA: 0x003083AC File Offset: 0x003065AC
		public override int doParseStatement(TCustomSqlStatement psql)
		{
			if (this.rootNode == null)
			{
				return -1;
			}
			TExecuteAsSqlNode texecuteAsSqlNode = (TExecuteAsSqlNode)this.rootNode;
			string text = texecuteAsSqlNode.LoginToken.ToString();
			if (text.Equals("USER", StringComparison.CurrentCultureIgnoreCase))
			{
				this.executeAsOption = EExecuteAsOption.eaoUser;
			}
			else if (text.Equals("CALLER", StringComparison.CurrentCultureIgnoreCase))
			{
				this.executeAsOption = EExecuteAsOption.eaoCaller;
			}
			else if (text.Equals("LOGIN", StringComparison.CurrentCultureIgnoreCase))
			{
				this.executeAsOption = EExecuteAsOption.eaoLogin;
			}
			this._loginName = texecuteAsSqlNode.loginName;
			this.noRevert = texecuteAsSqlNode.NoRevert;
			this.cookie = texecuteAsSqlNode.Cookie;
			base.doParseStatement(psql);
			return 0;
		}

		// Token: 0x06000D0B RID: 3339 RVA: 0x0030844B File Offset: 0x0030664B
		public override void accept(TParseTreeVisitor v)
		{
			v.preVisit(this);
			v.postVisit(this);
		}

		// Token: 0x06000D0C RID: 3340 RVA: 0x0030845B File Offset: 0x0030665B
		public override void acceptChildren(TParseTreeVisitor v)
		{
			v.preVisit(this);
			v.postVisit(this);
		}

		// Token: 0x040012FB RID: 4859
		private EExecuteAsOption executeAsOption;

		// Token: 0x040012FC RID: 4860
		private bool noRevert;

		// Token: 0x040012FD RID: 4861
		private TObjectName cookie;

		// Token: 0x040012FE RID: 4862
		private TObjectName _loginName;
	}
}
